﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using Cloak.NUnit;
using NUnit.Framework;

namespace Cloak.Linq
{
	public class CreateTypedFunc0Parameters : Behavior
	{
		private LambdaExpression _lambda;
		private Expression<Func<int>> _typedLambda;

		protected override void Given()
		{
			_lambda = Expression.Lambda(Expression.Constant(0));
		}

		protected override void When()
		{
			_typedLambda = _lambda.AsFunc<int>();
		}

		[Then]
		public void BodiesAreEqual()
		{
			Assert.AreEqual(_lambda.Body, _typedLambda.Body);
		}

		[Then]
		public void ParametersAreEqual()
		{
			Assert.IsTrue(_lambda.Parameters.SequenceEqual(_typedLambda.Parameters));
		}
	}
}